package com.ruoyi.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.domain.RandominSpectionRecord;
import com.ruoyi.service.IRandominSpectionRecordService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * RandominSpectionRecordController
 * 
 * @author ruoyi
 * @date 2025-01-11
 */
@RestController
@RequestMapping("/randominSpectionRecord")
public class RandominSpectionRecordController extends BaseController
{
    @Autowired
    private IRandominSpectionRecordService randominSpectionRecordService;

    /**
     * 查询RandominSpectionRecord列表
     */
    @RequiresPermissions("randominSpectionRecord:randominSpectionRecord:list")
    @GetMapping("/list")
    public TableDataInfo list(RandominSpectionRecord randominSpectionRecord)
    {
        startPage();
        List<RandominSpectionRecord> list = randominSpectionRecordService.selectRandominSpectionRecordList(randominSpectionRecord);
        return getDataTable(list);
    }

    /**
     * 导出RandominSpectionRecord列表
     */
    @RequiresPermissions("randominSpectionRecord:randominSpectionRecord:export")
    @Log(title = "RandominSpectionRecord", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, RandominSpectionRecord randominSpectionRecord)
    {
        List<RandominSpectionRecord> list = randominSpectionRecordService.selectRandominSpectionRecordList(randominSpectionRecord);
        ExcelUtil<RandominSpectionRecord> util = new ExcelUtil<RandominSpectionRecord>(RandominSpectionRecord.class);
        util.exportExcel(response, list, "RandominSpectionRecord数据");
    }

    /**
     * 获取RandominSpectionRecord详细信息
     */
    @RequiresPermissions("randominSpectionRecord:randominSpectionRecord:query")
    @GetMapping(value = "/{InspectID}")
    public AjaxResult getInfo(@PathVariable("InspectID") Long InspectID)
    {
        return success(randominSpectionRecordService.selectRandominSpectionRecordByInspectID(InspectID));
    }

    /**
     * 新增RandominSpectionRecord
     */
    @RequiresPermissions("randominSpectionRecord:randominSpectionRecord:add")
    @Log(title = "RandominSpectionRecord", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody RandominSpectionRecord randominSpectionRecord)
    {
        return toAjax(randominSpectionRecordService.insertRandominSpectionRecord(randominSpectionRecord));
    }

    /**
     * 修改RandominSpectionRecord
     */
    @RequiresPermissions("randominSpectionRecord:randominSpectionRecord:edit")
    @Log(title = "RandominSpectionRecord", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody RandominSpectionRecord randominSpectionRecord)
    {
        return toAjax(randominSpectionRecordService.updateRandominSpectionRecord(randominSpectionRecord));
    }

    /**
     * 删除RandominSpectionRecord
     */
    @RequiresPermissions("randominSpectionRecord:randominSpectionRecord:remove")
    @Log(title = "RandominSpectionRecord", businessType = BusinessType.DELETE)
	@DeleteMapping("/{InspectIDs}")
    public AjaxResult remove(@PathVariable Long[] InspectIDs)
    {
        return toAjax(randominSpectionRecordService.deleteRandominSpectionRecordByInspectIDs(InspectIDs));
    }
}
